package com.erp.remote.information;

import com.erp.entity.information.Department;
import com.erp.util.AjaxResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;


/**
 * 部门的公共接口
 */
@RequestMapping("/information/department")
public interface DepartmentRemote {

    @RequestMapping("/selectAllDepartment")
    AjaxResult selectAllDepartment();

    @RequestMapping("/selectDepartmentByCompanyId")
    AjaxResult selectDepartmentByCompanyId(@RequestParam("companyId") Integer companyId);

    //7.9后加的接口
    @RequestMapping("/selectDepartmentByCompanyIdPage")
    AjaxResult selectDepartmentByCompanyIdPage(@RequestBody Map<String, Object> params);

    /**
     * 根据地区的编码查询数据，含companyId
     * @param params
     * @return
     */
    @RequestMapping("/getDepartmentByDescription")
    AjaxResult getDepartmentByDescription(@RequestBody Map<String,Object> params);

    @RequestMapping("/addDepartment")
    AjaxResult addDepartment(@RequestBody Department department);

    /**
     * 用于在新增时，根据DepartmentCode验证地区编码是否唯一
     * @param departmentCode
     * @return
     */
    @RequestMapping("/checkDepartmentOnly")
    AjaxResult checkDepartmentOnly(@RequestParam("departmentCode") String departmentCode);

    @RequestMapping("/updateDepartment")
    AjaxResult updateDepartment(@RequestBody Department department);

    /**
     * 启用地区
     * @param params
     * @return
     */
    @PostMapping("/enableDepartment")
    AjaxResult enableDepartment(@RequestBody Map<String,Object> params);

    /**
     * 禁用地区
     * @param params
     * @return
     */
    @PostMapping("/disableDepartment")
    AjaxResult disableDepartment(@RequestBody Map<String,Object> params);

    @PostMapping("/getDepartmentPosition")
    AjaxResult getDepartmentPosition(@RequestParam("companyId") Integer companyId);
}
